

class RouteDetail:

    def __new__(cls, *args, **kwargs):
        return super().__new__(cls)

    def __init__(self, r_id, route, a_type=1, v_count=10, simple_passenger_ratio=2, bus_ratio=3, autonomous_ratio=5):
        """
        路线详情 (str, list(), int, int, int, int, int)
        :param r_id: 路线id
        :param route: 路线集合
        :param a_type: 路线类型 1：文件自带 2：添加发车点
        :param v_count: 车辆总数
        :param simple_passenger_ratio: 普通小客车比例
        :param bus_ratio: 大客车比例
        :param autonomous_ratio: 网联小客车比例
        """
        self.id = r_id
        self.route = route
        self.type = a_type
        self.depart = _DepartInfo(route[0], v_count, simple_passenger_ratio, bus_ratio, autonomous_ratio)
        self.arrive = route[-1]

    def to_dict(self):
        return {
            'id': self.id,
            'route': self.route,
            'type': self.type,
            'depart': self.depart.to_dict(),
            'arrive': self.arrive
        }


class _DepartInfo:

    def __new__(cls, *args, **kwargs):
        return super().__new__(cls)

    def __init__(self, point, v_count, simple_passenger_ratio, bus_ratio, autonomous_ratio):
        """
        发车点信息 (list(), int, int, int, int)
        :param point: 发车点坐标
        :param v_count: 车辆总数
        :param simple_passenger_ratio: 普通小客车比例
        :param bus_ratio: 大客车比例
        :param autonomous_ratio: 网联小客车比例
        """
        self.point = point
        self.count = v_count
        self.simple_passenger_ratio = simple_passenger_ratio
        self.bus_ratio = bus_ratio
        self.autonomous_ratio = autonomous_ratio

    def to_dict(self):
        return {
            'point': self.point,
            'count': self.count,
            'simplePassengerRatio': self.simple_passenger_ratio,
            'busRatio': self.bus_ratio,
            'autonomousRatio': self.autonomous_ratio
        }
